// 导出所有存储
export * from './projectStore'
export * from './chapterStore'
export * from './characterStore'
export * from './settingsStore'
export * from './aiAssistantStore'
export * from './uiStore'
export * from './dragDropStore'

// 提供重置所有状态的函数
import { create } from 'zustand'

interface RootState {
  resetAllStores: () => void;
}

export const useRootStore = create<RootState>((set) => ({
  resetAllStores: () => {
    // 导入所有存储
    const { 
      useProjectStore,
      useChapterStore,
      useCharacterStore,
      useSettingsStore,
      useAIAssistantStore,
      useUIStore,
      useDragDropStore
    } = require('./')
    
    // 获取默认设置
    const { DEFAULT_SETTINGS } = require('./settingsStore')
    
    // 重置每个存储
    useProjectStore.setState({ 
      projects: [], 
      currentProject: null,
      isLoading: false,
      error: null
    })
    
    useChapterStore.setState({ 
      chapters: [], 
      currentChapter: null,
      isLoading: false,
      error: null
    })
    
    useCharacterStore.setState({ 
      characters: [], 
      currentCharacter: null,
      isLoading: false,
      error: null
    })
    
    useSettingsStore.setState(DEFAULT_SETTINGS)
    
    useAIAssistantStore.setState({ 
      conversations: [],
      currentConversation: null,
      isLoading: false,
      isSending: false,
      error: null
    })
    
    useUIStore.setState({
      isSidebarOpen: true,
      isRightSidebarOpen: false,
      activeModal: null,
      modalData: {},
      isDragging: false,
      dragSource: null,
      isAIAssistantOpen: false
    })
    
    useDragDropStore.setState({
      currentSession: null,
      droppedItems: [],
      dragHistory: [],
      isLoading: false,
      error: null
    })
  }
})) 